﻿using System.Collections.Generic;
using System.Linq.Expressions;

namespace System.Data.Repository
{
    public interface IRepository<T>
        where T : class
    {
        #region Delete Methods
        long Delete(IEnumerable<T> objects);
        bool Delete(T oneObject);
        bool DeleteAll();
        bool DeleteById(object id); 
        #endregion

        #region Retrieve Methods
        T GetById(object id);
        T GetSingle(Expression<Func<T, bool>> predicate); 
        
        IEnumerable<T> Select();
        IEnumerable<T> Select(Expression<Func<T, bool>> predicate);
        #endregion

        #region Save Methods
        IEnumerable<T> Insert(IEnumerable<T> objects);
        bool Insert(T oneObject);

        IEnumerable<T> InsertOrUpdate(IEnumerable<T> objects);
        bool InsertOrUpdate(T oneObject); 
        #endregion

        bool Exists(Expression<Func<T, bool>> predicate);
    }
}
